let { AsyncParallelHook } = require('./tapable');
let hook = new AsyncParallelHook(['name', 'age']);
console.time('cost');
debugger
hook.tapPromise('1', (name, age) => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log(1, name, age);
            resolve();
        }, 1000);
    });
});
hook.tapPromise('1', (name, age) => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log(1, name, age);
            resolve();
        }, 2000);
    });
});
hook.tapPromise('1', (name, age) => {
    return new Promise((resolve, reject) => {
        setTimeout(() => {
            console.log(1, name, age);
            resolve();
        }, 3000);
    });
});
debugger
hook.promise('zhufeng', 10).then((data) => {
    console.log('成功', data);
    console.timeEnd('cost');
}, (err) => {
    console.log('失败', err);
    console.timeEnd('cost');
});